//前 后 切换卡
$(document).on('click','.nav-item',function(){
	$(this).addClass("selected").siblings().removeClass('selected');
	const target = $(this).parent().attr('data-target');
	if(target === 'fwqrwwclph'){
		fwqrwwclphChange($(this).attr('data-target'));
	}else if(target === 'fwqrwzglph'){
		fwqrwzglphChange($(this).attr('data-target'));
	}else if(target === 'fwqcllph'){
		fwqcllphChange($(this).attr('data-target'));
	}else if(target === 'fwqkllph'){
		fwqkllphChange($(this).attr('data-target'));
	}else if(target === 'klgxdph'){
		klgxdphChange($(this).attr('data-target'));
	}else if(target === 'fwqdfph'){
		fwqdfphChange($(this).attr('data-target'));
	}
})
//统一代办 通知公告 消息提醒 切换
$(document).on('click','.titleClick',function(){
	const tg = $(this).attr("data-target");
	$(this).addClass("selected").parent().siblings().find('.titleClick').removeClass('selected');
	$(".roll").hide();
	$("." + tg + "-target").show();
})

$(document).on('click','.chart-nav',function(){
	$(this).find('span').addClass('selected').parent().siblings().find('span').removeClass('selected');
	const target = $(this).parent().attr('data-target');
	if(target === 'jjrclldb'){
		jjrclldbChange();
	}else if(target === 'jjrklldb'){
		jjrklldbChange();
	}else if(target === 'fwqdfph'){
		fwqdfphChange();
	}
})

$(document).on("click",".dio-layer-open",function(){
	const url = $(this).attr('data-url');
	const html = `<div class="dio-layer">
				<div class="dio-layer-mask"></div>
				<div class="dio-layer-main">
					<div class="dio-layer-close"></div>
					<iframe src="${url}" ></iframe>
				</div>
			</div>`
	$('body').append(html);
	$(".dio-layer").show();
})

$(document).on("click",".dio-layer-close",function(){
	$(".dio-layer").remove();
})

function selectAllCheckboxes() {
	var selectAll = document.getElementsByClassName('all_check')[0];
	var checkboxes = document.getElementsByClassName('all_check_child');
	for (var i = 0; i < checkboxes.length; i++) {
		checkboxes[i].checked = selectAll.checked;
	}
}

 window.onload = function() {
	var selectAll = document.getElementsByClassName('all_check')[0];
	if(!selectAll) return;
	var checkboxes = document.getElementsByClassName('all_check_child');
	var allChecked = true;
	for (var i = 0; i < checkboxes.length; i++) {
		if (!checkboxes[i].checked) {
			allChecked = false;
			break;
		}
	}
	selectAll.checked = allChecked;

	// 添加子选框状态改变事件监听器，以更新全选框状态
	for (var i = 0; i < checkboxes.length; i++) {
		checkboxes[i].addEventListener('change', function() {
			var allCheckedNow = true;
			for (var j = 0; j < checkboxes.length; j++) {
				if (!checkboxes[j].checked) {
					allCheckedNow = false;
					break;
				}
			}
			selectAll.checked = allCheckedNow;
		});
	}
}

function selectAllCheckboxes() {
	var selectAll = document.getElementsByClassName('all_check')[1];
	var checkboxes = document.getElementsByClassName('all_check_child2');
	for (var i = 0; i < checkboxes.length; i++) {
		checkboxes[i].checked = selectAll.checked;
	}
}

 window.onload = function() {
	var selectAll = document.getElementsByClassName('all_check')[1];
	if(!selectAll) return;
	var checkboxes = document.getElementsByClassName('all_check_child2');
	var allChecked = true;
	for (var i = 0; i < checkboxes.length; i++) {
		if (!checkboxes[i].checked) {
			allChecked = false;
			break;
		}
	}
	selectAll.checked = allChecked;

	// 添加子选框状态改变事件监听器，以更新全选框状态
	for (var i = 0; i < checkboxes.length; i++) {
		checkboxes[i].addEventListener('change', function() {
			var allCheckedNow = true;
			for (var j = 0; j < checkboxes.length; j++) {
				if (!checkboxes[j].checked) {
					allCheckedNow = false;
					break;
				}
			}
			selectAll.checked = allCheckedNow;
		});
	}
}